<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
     <form action="" method="get">
        <input id="username" type="text" name="username" value="" placeholder="请输入用户名" /><br/>
        <input id="password" type="password" name="password" placeholder="请输入密码" /><br>
        <button type="button">提交</button>
    </form>
    <script>
         let xhr=new XMLHttpRequest()
    xhr.open("GET","url"+"?username="+name+"&password="+pass,false)
    xhr.onreadystatechange=function(){
        if(xhr.readyState===4&&xhr.status===200){
            console.log("请求成功")
        }
    }
    console.log("代码1")
    xhr.send()
    console.log("代码2")
    console.log("代码3")

    </script>
</body>
</html>l